package org.example.rubbish.dto;

public class ProductQuery {
    private Integer page = 1;
    private Integer limit = 10;
    private String search;
    private Integer status;
    private String category;
    private Integer offset; // 添加 offset 字段

    // 无参构造
    public ProductQuery() {}

    // 有参构造
    public ProductQuery(Integer page, Integer limit, String search, Integer status, String category) {
        this.page = page;
        this.limit = limit;
        this.search = search;
        this.status = status;
        this.category = category;
        this.offset = (page - 1) * limit; // 计算 offset
    }

    // 计算偏移量
    public Integer getOffset() {
        return (page - 1) * limit;
    }

    // 添加 setOffset 方法
    public void setOffset(Integer offset) {
        this.offset = offset;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }
}